package com.chenyi.pay.config;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * 支付宝支付配置
 * @author wangkh
 * @date 2020/10/27 0027  16:39
 */
@Component
@ConfigurationProperties(prefix = "pay.ali")
@PropertySource(value = { "classpath:pay.yml" })
public class AliPayConfig {
    public static String gatewayUrl;
    public static String appId;
    public static String merchantPrivateKey;
    public static String alipayPublicKey;
    public static String signType;
    public static String charset;
    public static String returnUrl;
    public static String notifyUrl;

    public static String getGatewayUrl() {
        return gatewayUrl;
    }

    @Value("${gateway_url}")
    public void setGatewayUrl(String gatewayUrl) {
        AliPayConfig.gatewayUrl = gatewayUrl;
    }

    public static String getAppId() {
        return AliPayConfig.appId;
    }

    @Value("${app_id}")
    public void setAppId(String appId) {
        AliPayConfig.appId = appId;
    }

    public static String getMerchantPrivateKey() {
        return AliPayConfig.merchantPrivateKey;
    }

    @Value("${merchant_private_key}")
    public void setMerchantPrivateKey(String merchantPrivateKey) {
        AliPayConfig.merchantPrivateKey = merchantPrivateKey;
    }

    public static String getAlipayPublicKey() {
        return AliPayConfig.alipayPublicKey;
    }

    @Value("${alipay_public_key}")
    public void setAlipayPublicKey(String alipayPublicKey) {
        AliPayConfig.alipayPublicKey = alipayPublicKey;
    }

    public static String getSignType() {
        return AliPayConfig.signType;
    }

    @Value("${sign_type}")
    public void setSignType(String signType) {
        AliPayConfig.signType = signType;
    }

    public static String getCharset() {
        return AliPayConfig.charset;
    }

    @Value("${charset}")
    public  void setCharset(String charset) {
        AliPayConfig.charset = charset;
    }

    public static String getReturnUrl() {
        return AliPayConfig.returnUrl;
    }

    @Value("${return_url}")
    public void setReturnUrl(String returnUrl) {
        AliPayConfig.returnUrl = returnUrl;
    }

    public static String getNotifyUrl() {
        return AliPayConfig.notifyUrl;
    }

    @Value("${notify_url}")
    public void setNotifyUrl(String notifyUrl) {
        AliPayConfig.notifyUrl = notifyUrl;
    }
}
